package Synchronized;

import cn.hutool.core.img.ColorUtil;

import java.util.ArrayList;
import java.util.Collection;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/**
 *
 */
public class Example {
    private final Lock lock = new ReentrantLock();
    Collection<Player> players = new ArrayList<>();

    public void addPlayer(Integer userId, Integer rating, Integer selected_bot_id) {
        lock.lock();
        try {
            players.add(new Player(userId, rating, selected_bot_id, 0));
        } finally {
            lock.unlock();
        }
    }
}